import {INCREMENT} from "./mutations_type"
export default  {
    [INCREMENT](state){
        state.counter++
    },
    // increment(state){
    //     state.counter++
    // },
    decrement(state){
        state.counter--
    },
    incrementCount(state,payload){
        window.console.log(payload)
        state.counter += payload.count   
    },
    addStudent(state,stu){
        state.students.push(stu)
    },
    updateInfo(state) {
        state.info.name = "coderwhy"
    
        // 错误代码不能在这里进行异步操作
        // setTimeout(() =>{
        //     state.info.name = "coderwhy"
        // })
        // state.info['address']= "beijing"
    // 可以添加到响应式系统
        // Vue.set(state.info,'address',"北京")
        // 该方式也不能做到响应式
        // delete state.info.age
        // 可以响应式  删除
        // Vue.delete(state.info,'age')
    }
} 